home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / D-G / FORTRAN Goodies / Path.txt < prev    next >
Encoding:
Text File  |  1991-08-15  |  1.6 KB  |  49 lines  |  [TEXT/MPS ]

  1. !!MP inlines.f
  2. C    © Copyright 1991 Language Systems Corp.
  3. C    All rights reserved.
  4.  
  5. C    Path.f 8/15/91
  6. C
  7. C        This is a program that returns the full pathname of the textfile
  8. C    that the user creates.  This code runs under System 7 and later.
  9. C    The source code uses the System 7 call FSMakeFSSpec to determine
  10. C    the full source path of the chosen file.  This code can be easily 
  11. C    modified to return the pathname of an already existing file.
  12. C    The latest inlines and include files are needed in order for this 
  13. C    code to work.
  14.  
  15.     program testvol
  16. !!I StandardFile.f
  17.     record /sftypelist/ mytypes
  18.     record /standardfilereply/ thereply
  19.     record /FSSpec/ myfilespec, scratchspec
  20.     string*255 s,filename
  21.     
  22.     mytypes.OSTy(0) = 'TEXT'
  23.     s = 'Name the new file'
  24.     filename = 'Newfile'
  25. c    Call StandardGetFile(nil,int2(1),mytypes,%ref(thereply))
  26.     Call StandardPutFile(s,filename,%ref(thereply))
  27.     If (thereply.sfgood = 0) go to 100
  28.     myfilespec = thereply.sfFile
  29.     filename = myfilespec.name
  30.     write(*,*) 'The volume refnum is ',myfilespec.vrefnum
  31.     write(*,*) 'The parent dir id is ',myfilespec.parID
  32.     write(*,*) 'The name of the file is ',myfilespec.name
  33.     write(*,*) 'Path name is ',filename
  34. 200    s = ''
  35.     ierr = FSMakeFSSpec(myfilespec.vrefnum, myfilespec.parID, s,%ref(scratchspec))
  36.     if (ierr .ne. 0) go to 300
  37.     myfilespec = scratchspec
  38.     filename = myfilespec.name // ":" // filename
  39.     write(*,*) 'The volume refnum is ',myfilespec.vrefnum
  40.     write(*,*) 'The parent dir id is ',myfilespec.parID
  41.     write(*,*) 'The name of the folder is ',myfilespec.name
  42.     write(*,*) 'Path name is ',filename
  43.     go to 200
  44. 300    open(1,file=filename)
  45.     write(1,*) 'testing'
  46.     close(1)
  47. 100    continue
  48.     end
  49.